package xyz.zdsoft.course_manage_module.service.imp;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import xyz.zdsoft.course_manage_module.bo.SelCourseInfoGch;
import xyz.zdsoft.course_manage_module.mapper.TermSelCourseGchMapper;
import xyz.zdsoft.course_manage_module.service.AdminTermSelCourseService;
import xyz.zdsoft.course_manage_module.vo.AdminCourseInfo;
import xyz.zdsoft.project_group_manage_module.entity.MyDto.RespPageBean;

import javax.annotation.Resource;
@Service
public class AdminTermCourseServiceImpl implements AdminTermSelCourseService {
    @Resource
    private TermSelCourseGchMapper termSelCourseGchMapper;
    /**
     * 管理员条件查询所有课程(分页)
     * @param currentPage
     * @param size
     * @param selCourseInfoGch
     * @return
     */
    @Override
    public RespPageBean termSelCourse(Integer currentPage, Integer size, SelCourseInfoGch selCourseInfoGch) {
        //开启分页
        Page<AdminCourseInfo> page=new Page<>(currentPage,size);
        IPage<AdminCourseInfo> courseByPage =termSelCourseGchMapper.TermSelCourse(page,selCourseInfoGch);
        RespPageBean respPageBean=new RespPageBean(courseByPage.getTotal(),courseByPage.getRecords());
        return respPageBean;
    }
}
